# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#   
#   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
#   Major.create(:name => 'Daley', :city => cities.first)
# =>创建管理员帐号
admin = User.create do |user|
  user.username = "xuhao"
  user.email = "xuhao@rubyfans.com"
  user.website = "http://www.rubyfans.com"
  user.password = "xuhao8890"
  user.password_confirmation = "xuhao8890"
  user.role = "boss"
end

# =>创建初始栏目
init_category = Category.create do |category|
  category.name = "心路历程"
  category.parent_id = 0
end

# =>创建初始日志
Post.create! do |post|
  post.title = "Hello World!"
  post.content = "因为路过你的路，所以苦过你的苦，因为悲伤过你的悲伤，所以追逐着你的追逐。"
  post.user = admin
  post.category = init_category
end
